import { Notify, Toast } from 'vant'

const danger = function (msg, time) {
  return Notify({ type: 'danger', message: msg, duration: 1500 })
}
const primary = function (msg, time) {
  return Notify({ type: 'primary', message: msg, duration: 1500 })
}
const success = function (msg, time) {
  return Notify({ type: 'success', message: msg, duration: time || 1500 })
}
const warning = function (msg, time) {
  return Notify({ type: 'warning', message: msg, duration: 1500 })
}
const toast = function (msg, position, time) {
  return Toast({
    message: msg,
    position: position,
    duration: 3000 || time
  })
}

const notify = {
  danger,
  primary,
  success,
  warning,
  toast
}

export default notify
